import time, zipfile, os

path = "knowledge-space_V2"
zipName = "knowledge-space_V2_" + time.strftime("%Y%m%d%H%M", time.localtime()) + ".zip"

zip = zipfile.ZipFile(zipName, "w", zipfile.ZIP_DEFLATED)
for root, dirs, files in os.walk(path):
    for file in files:
        zip.write(
            os.path.join(root, file), os.path.relpath(os.path.join(root, file), path)
        )
    for dir in dirs:
        zip.write(
            os.path.join(root, dir), os.path.relpath(os.path.join(root, dir), path)
        )
zip.close()
